[OAS] extract schemas as referenced components#249978
[OAS] extract schemas as referenced components#249978TinaHeiligers wants to merge 44 commits intoelastic:mainfrom
Conversation
… components from there, keep path as API path, reset proeprtyPath to not reinclude props and conetnt
jloleysens
left a comment
There was a problem hiding this comment.
Hey @TinaHeiligers nice work, I did first pass of review and left a few comments. Mainly wanted to call out:
- Can we ensure we are also traversing into the existing
schemas.componentsobject - Can we restructure our test strategy to rather make assertions like
expect(schema).toEqual({ ... }). This would be a lot easier to follow and ensure that the tests are doing - Can we revert the deletions of
api_docs?
…tionalProperties, patternProperties or composition types
jloleysens
left a comment
There was a problem hiding this comment.
Thanks for addressing my feedback @TinaHeiligers ! Left a couple further comments
|
/ci |
…kibana into kbn24462_componentize_oas
|
Pinging @elastic/fleet (Team:Fleet) |
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
| }); | ||
| } | ||
|
|
||
| async function resolveExternalReferences( |
There was a problem hiding this comment.
needed to resolve external references because `redocly doesn't seem to handle it
This comment was marked as outdated.
This comment was marked as outdated.
…n as used in other scripts
…kibana into kbn24462_componentize_oas
flash1293
left a comment
There was a problem hiding this comment.
The streams change is kinda unrelated to the PR. Also, we shouldn't do this here, since this is about the streamlang syntax which isn't i18n-ified. Please either roll back or use {'includes'} / {'excludes'} to get rid of the warning
|
@flash1293 I have no idea how that change got there! I'll be cleaning it up when the work resumes soon. |
|
closing as superseded by #258986 |
Summary
fix #244662
Implements OpenAPI Schema (OAS)
componentizationto extract inlineschemasinto reusable components with$refreferences inmerge_ess_oas.jsandmerge_serverless_oas.js.The aim is to provide OAS docs that support tooling better for consuming teams generating clients from the OAS docs.
Change highlights
Existing component traversal - Processes pre-existing components (e.g.,
bedrock_config,jira_secrets) to extract nested schemasHTTP method filtering - Explicit allowlist (get, post, put, patch, delete, head, options, trace)
Object/composition handling - Extracts both object types and composition types (
oneOf/anyOf/allOf)Structural field detection - Extracts all objects with meaningful structure, not just those with
propertiesComponent naming - Name generation includes with
parentComponentNamecontext to prevent collisions in nested schemas.Documentation - mostly in jsdocs
enables unit testing! -
oas_docsnow supports jest tests 🎉Documentation was added for features that require explanation or tutorials (jsdocs)
Unit or functional tests were updated or added to match the most common scenarios
Risks
Potential future work
--dry-runmode for preview and an--overwriteflag to either persist the changes explicitly.MAX_RECURSION_DEPTHis not exceeded.